package main

import (
	"easyShop/core/config"
	"easyShop/core/database/mysql"
	"easyShop/messageQueue/rabbit/consumer"
	"easyShop/router"
	"easyShop/services"
	"github.com/gin-gonic/gin"
)
import _ "easyShop/router"

func main() {
	// 载入配置
	config.ParseConfig("./app.json")
	r := gin.Default()
	// 设置静态文件路径
	r.Static("/static", "./static")
	// 读取数据库源
	services.GetDatabaseSourceMap()
	// 链接数据库
	mysql.SetConnect()
	router.Router(r) // 引入路由
	go func() {
		// 加载Rabbit消费者
		consumer.ConsumerManager()
	}()
	r.Run(":" + config.GetConfig("app_port").(string))
}
